package com.tangrong.filesystem.visitor;

import com.tangrong.filesystem.Directory;
import com.tangrong.filesystem.FileLeaf;
import com.tangrong.filesystem.Link;
import com.tangrong.filesystem.File;

public class TestCatVisitor {
	
	public static void main(String[] args){
		
		File root = new Directory("dir root");
		root.addFile(new FileLeaf("file11"));
		root.addFile(new Directory("dir12"));
		File dir13 = new Directory("dir13");
		dir13.addFile(new FileLeaf("file21"));
		dir13.addFile(new FileLeaf("file22"));
		File dir23 = new Directory("dir 23");
		dir13.addFile(dir23);
		root.addFile(dir13);
		
		File rootLink = new Link(root,"rootlink");
		
		Visitor catVisitor = CatVisitor.getInstance();
		root.accept(catVisitor);
		
		System.out.println();
		System.out.println();
		
		dir13.removeFile(dir23);
		rootLink.accept(catVisitor);
	}
}
